package com.luych.toolbox.docker.service.controller;

import com.luych.toolbox.common.feign.intf.docker.service.DockerContainerFeign;
import com.luych.toolbox.common.feign.param.docker.service.DockerContainerParam;
import com.luych.toolbox.common.feign.view.docker.service.DockerContainerView;
import com.luych.toolbox.common.feign.view.docker.service.DockerStatDonutView;
import com.luych.toolbox.common.feign.view.docker.service.DockerStatLineView;
import com.luych.toolbox.common.page.CommonPageResult;
import com.luych.toolbox.docker.service.service.DockerContainerService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "容器")
@RestController
@RequestMapping("/container")
public class DockerContainerController implements DockerContainerFeign {

    private final DockerContainerService dockerContainerService;

    @Autowired
    public DockerContainerController(DockerContainerService dockerContainerService) {
        this.dockerContainerService = dockerContainerService;
    }

    @Override
    public CommonPageResult<DockerContainerView> page(long pageSize, long pageNumber, String sort, String order, String serverId, String keyword) {
        return dockerContainerService.page(pageSize, pageNumber, sort, order, serverId, keyword);
    }

    @Override
    public DockerContainerView get(String serverId, String id) {
        return dockerContainerService.get(serverId, id);
    }

    @Override
    public DockerContainerView create(String serverId, DockerContainerParam model) {
        return dockerContainerService.create(serverId, model);
    }

    @Override
    public void remove(String serverId, String id) {
        dockerContainerService.remove(serverId, id);
    }

    @Override
    public void start(String serverId, String id) {
        dockerContainerService.start(serverId, id);
    }

    @Override
    public void stop(String serverId, String id) {
        dockerContainerService.stop(serverId, id);
    }

    @Override
    public void restart(String serverId, String id) {
        dockerContainerService.restart(serverId, id);
    }

    @Override
    public void kill(String serverId, String id) {
        dockerContainerService.kill(serverId, id);
    }

    @Override
    public void pause(String serverId, String id) {
        dockerContainerService.pause(serverId, id);
    }

    @Override
    public void resume(String serverId, String id) {
        dockerContainerService.resume(serverId, id);
    }

    @Override
    public void rename(String serverId, String id, String name) {
        dockerContainerService.rename(serverId, id, name);
    }

    @Override
    public List<String> log(String serverId, String id, long tail) {
        return dockerContainerService.log(serverId, id, tail);
    }

    @Override
    public DockerStatDonutView cpuDonut(String serverId, String id) {
        return dockerContainerService.cpuDonut(serverId, id);
    }

    @Override
    public DockerStatDonutView memoryDonut(String serverId, String id) {
        return dockerContainerService.memoryDonut(serverId, id);
    }

    @Override
    public DockerStatLineView cpuLine(String serverId, String id, Integer second, Boolean date) {
        return dockerContainerService.cpuLine(serverId, id, second, date);
    }

    @Override
    public DockerStatLineView memoryLine(String serverId, String id, Integer second, Boolean date) {
        return dockerContainerService.memoryLine(serverId, id, second, date);
    }
}
